package org.example.controller.user;

import org.example.dao.commom.Result;
import org.example.dao.commom.ResultCode;
import org.example.dao.dto.user.UserDto;
import org.example.dao.entity.user.AuPermission;
import org.example.dao.entity.user.AuRole;
import org.example.dao.entity.user.AuUserRole;
import org.example.dao.entity.user.UUser;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;
import java.util.List;

@RestController
@RequestMapping("/user")
@CrossOrigin
public class AuthController {


    //TODO 新增

    /**
     * 为用户分配角色(管理)
     */
    @PostMapping("/insertUserRoles")
    public Result insertUserRoles(@PathParam("userId") String userId, @RequestBody List<Long> ids) {


        return new Result(ResultCode.SUCCESS, null);
    }

    /**
     * 为角色分配权限(管理)
     */
    @PostMapping("insertRolePermissions")
    public Result insertRolePermissions(@PathParam("userId")  String roleId, @RequestBody List<Long> ids) {


        return null;
    }

    //TODO 查询

    /**
     * 查询用户相关角色和权限(管理)
     */
    @PostMapping("/selectUserPermission")
    public Result selectUserPermission(@RequestBody UUser user) {
        Long id = user.getId();

        return new Result(ResultCode.SUCCESS, null);
    }

    /**
     * 查看角色绑定的用户(管理)
     */
    @PostMapping("/selectUserByRole")
    public Result selectUserByRole(@RequestBody AuRole auRole) {
        Long id = auRole.getId();

        return new Result(ResultCode.SUCCESS, null);
    }

    /**
     * 查看权限绑定过的用户(管理)
     */
    @PostMapping("selectUserByPermission")
    public Result selectUserByPermission(@RequestBody AuPermission auPermission) {
        Long id = auPermission.getId();

        return null;
    }
    //TODO 更新


    //TODO 删除

    /**
     * 删除用户角色(管理)
     */
    @PostMapping("deleteUserRole")
    public Result deleteUserRole(@RequestBody AuUserRole auUserRole) {
        Long id = auUserRole.getId();


        return null;
    }

    /**
     * 批量删除用户角色(管理)
     */
    @PostMapping("/deleteUserRoles")
    public Result deleteUserRoles(@PathParam("userId")  String userId, @RequestBody List<Long> ids) {

        return new Result(ResultCode.SUCCESS, null);
    }


}
